using System;
using System.Collections.Generic;
using System.Text;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Exceptions;

namespace SchEdu.Framework.Validators
{
    public class AllocationStartDateValidator : Validator
    {
        public AllocationStartDateValidator()
        {
        }

        public AllocationStartDateValidator(SchEduData schEduData, SchEduDataSet.SolutionRow solution)
            : base(schEduData,solution)
        {
        }

        #region IValidator Members

        public override void Validate()
        {
            AllocationList allocations = new AllocationList(Solution.GetAllocationRows());

            foreach (SchEduDataSet.AllocationRow allocation in allocations)
            {
                if (allocation.IsStartDateNull() == true)
                {
                    throw new ValidatorException(string.Format(Resources.AllocationDoesNotHaveStartDate, allocation.ID));
                }
            }
        }

        #endregion
    }
}
